package com.sugar.subscribe.course.module.business.controller.app.withdrawrecord.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.sugar.subscribe.course.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "APP - 提现记录 Response VO")
@Data
public class AppWithdrawRecordRespVO {

    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1707")
    private Long id;

    @Schema(description = "提现金额", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal amount;

    @Schema(description = "提现状态：[0待审核；1审核通过；2已到账；3审核拒绝；4提现失败]", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private Integer status;

    @Schema(description = "失败/拒绝原因")
    private String failCause;

    @Schema(description = "提现到账时间")
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime doneTime;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime createTime;
}
